package com.enhe.gck.fg;

import com.alibaba.fastjson.JSON;
import com.enhe.gck.item.GoodsHWANE16621Item;
import com.enhe.gck.pojo.Address;
import com.kuangkie.carbon.common.RemoveRecordInfo;
import com.kuangkie.carbon.fg.*;
import com.kuangkie.carbon.panel.CarbonPanel;
import org.springframework.stereotype.Repository;
import com.kuangkie.carbon.record.FGRecordComplexus;
import com.kuangkie.carbon.record.ProRecord;
import com.enhe.gck.CarbonBaseConstant; //模型Code
import com.enhe.gck.CarbonEnumKeyValue; //枚举字典信息
import com.enhe.gck.CarbonRelationType; //关系类型Code
import com.enhe.gck.item.AddressHWANE18426Item; // 模型属性Code

import java.util.Collection;

@Repository(value = "hwane18426366042330866425862")
public class AddressHWANE18426BNB implements SecondRoundImproveFuncGroup {
	
	@Override
	public void secondImprove(FuncGroupContext context, ProRecord proRecord, FGRecordComplexus recordComplexus,
			ImproveResultFactory improveResultFactory) {
		Address info=proRecord.getBean(Address.class);
		if(info.getFlagDelete()){
			Collection<String> listZid=CarbonPanel.getRecordDiscover(CarbonBaseConstant.地点管理_ddgl).getProRecord(proRecord.getRecordCode()).getGuestRecordCodes(CarbonRelationType.RR_地点管理_父_地点_地点管理);
			rlg(improveResultFactory,listZid);
		}
	}

	private void rlg(ImproveResultFactory improveResultFactory,Collection<String> listZid){
		if(listZid!=null && !listZid.isEmpty()){
			for (String zid:listZid){
				improveResultFactory.getProRecordOpsBuilder(CarbonBaseConstant.地点管理_ddgl,zid).putAttribute(AddressHWANE18426Item.基本属性组_是否删除,true);
				Collection<String> listZzid=CarbonPanel.getRecordDiscover(CarbonBaseConstant.地点管理_ddgl).getProRecord(zid).getGuestRecordCodes(CarbonRelationType.RR_地点管理_父_地点_地点管理);
				rlg(improveResultFactory,listZzid);
			}
		}
	}
}
